﻿using _11._24._2014_AngularPractice.Adapters;
using _11._24._2014_AngularPractice.Adapters.Data;
using _11._24._2014_AngularPractice.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace _11._24._2014_AngularPractice.Controllers
{
    public class SearchController : ApiController
    {
        private ISearchAdapter _adapter;

        public SearchController()
        {
            _adapter = new SearchDataAdapter();
        }

        public IHttpActionResult Get(string id, [FromUri] int pageNum)
        {
            SearchViewModel model = _adapter.Search(id, pageNum);
            return Ok(model);
        }

        public IHttpActionResult Get([FromUri] int pageNum)
        {
            SearchViewModel model = _adapter.Search(null, pageNum);
            return Ok(model);
        }
    }
}
